From 6501ac6994ade911cc15bd64325dab4a3fffbcfc Mon Sep 17 00:00:00 2001 From: Alastair Tse Date: Wed, 31 Jan 2007 12:58:41 +0000 Subject: [PATCH] [XEND] Make python-pam warning only appear if using XenAPI Signed-off-by: Alastair Tse --- tools/python/xen/xend/XendAuthSessions.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/python/xen/xend/XendAuthSessions.py b/tools/python/xen/xend/XendAuthSessions.py index 5c9a4e9a2f..769c66f3fa 100644 --- a/tools/python/xen/xend/XendAuthSessions.py +++ b/tools/python/xen/xend/XendAuthSessions.py @@ -21,11 +21,6 @@ from xen.xend import uuid from xen.xend.XendError import * from xen.xend.XendLogging import log -try: - import PAM -except ImportError: - log.warn("python-pam is required for XenAPI support.") - class XendAuthSessions: """Keeps track of Xen API Login Sessions using PAM. @@ -80,7 +75,11 @@ class XendAuthSessions: """ pam_auth = None try: + import PAM pam_auth = PAM.pam() + except ImportError: + log.warn("python-pam is required for XenAPI support.") + return False except NameError: # if PAM doesn't exist, let's ignore it return False -- 2.30.2